package com.example.Service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.Service.DailyService;
import com.example.dao.DailyMapper;
import com.example.pojo.Daily;
import com.example.pojo.DailyData;
import com.example.pojo.User;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DailyServiceImpl extends ServiceImpl<DailyMapper, Daily> implements DailyService {

    @Autowired
    private DailyMapper dailyMapper;

    public PageInfo<Daily> selectDaily(Daily daily, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<Daily> list = dailyMapper.selectDaily(daily);
        return new PageInfo<>(list);
    }

    public PageInfo<DailyData> selectDailyData(DailyData dailyData,Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        List<DailyData> list = dailyMapper.selectDailyData(dailyData);
        return new PageInfo<>(list);
    }


    public Daily selectDailyViewId(Integer id) {
        return dailyMapper.selectDailyViewId(id);
    }

    public PageInfo<Daily> selectMyDaily(Integer id) {
        PageHelper.startPage(1,99);
        List<Daily> list = dailyMapper.selectMyDaily(id);
        return new PageInfo<>(list);
    }


    public Integer selectTeamId(Integer id) {
        return dailyMapper.selectTeamId(id);
    }

    public List<Daily> selectTeamDaily(String employeeId, String departmentId) {
        return dailyMapper.selectTeamDaily(employeeId, departmentId);
    }

    public int insert(Daily daily) {
        return dailyMapper.insertDaily(daily);
    }
}
